import 'package:sow_app_core/src/repository/cache_repository.dart';

import '../controller/controller.dart';
import '../presenter/app_presenter.dart';
import '../repository/rest_client.dart';
import '../repository/token_repository.dart';
import '../usecase/app_usecase.dart';
import '../usecase/cache_usecase.dart';
import '../usecase/token_usecase.dart';
import '../usecase/usecase.dart';

abstract class AppController extends Controller {
  final AppPresenter appPresenter;
  final TokenRepository tokenRepository;
  final CacheRepository cacheRepository;
  final RestClient client;

  AppController(this.appPresenter, this.tokenRepository, this.client,
      this.cacheRepository);
  void init() => AppInitUseCase(
      GetCacheUseCase(cacheRepository),
      UpdateAjaxClientInfoUseCase(client),
      GetTokenUseCase(tokenRepository, client),
      appPresenter)(NoParams());

  void pageChange(value) =>
      AppPageChangeUseCase(appPresenter, tokenRepository, client)(value);
}
